feat: set the default value of includes.path on dtk_build.prf
authorzccrs <ccrr1314@live.com>
Wed, 7 Mar 2018 02:17:13 +0000 (10:17 +0800)
committerzccrs <ccrr1314@live.com>
Wed, 7 Mar 2018 02:23:14 +0000 (10:23 +0800)
Change-Id: I32d21e302375da6dceb223fb2e63a4dff8c379e3

src/dtk_build.prf
src/src.pro

index 273fd3baddccc16a0cee67d859a8c11ad6dc0d90..395303addc245a8e2b7e95e5d75e8cb720dc5846 100644 (file)
@@ -1,3 +1,7 @@
+isEmpty(TARGET): error(set TARGET first)
+!contains(TARGET, ^dtk[a-z0-9]+$): error(The format of the value of TARGET is incorrect. eg: dtk[a-z0-9]+)
+!isEqual(TARGET, dtkcore):!contains(QT, dtkcore): error(QT += dtkcore first)
+
 defineTest(checkDtkVersion) {
     isEmpty(VERSION) {
         !isEqual(TARGET, dtkcore) {
@@ -49,20 +53,27 @@ isEmpty(PREFIX){
 }
 
 isEmpty(LIB_INSTALL_DIR) {
-    LIB_INSTALL_DIR=$$PREFIX/lib
-    target.path = $$PREFIX/lib
-} else {
-    target.path = $$LIB_INSTALL_DIR
+    isEqual(TARGET, dtkcore) {
+        LIB_INSTALL_DIR=$$PREFIX/lib
+    } else {
+        LIB_INSTALL_DIR=$${QT.dtkcore.libs}
+    }
 }
 
+isEmpty(target.path): target.path = $$LIB_INSTALL_DIR
+
 isEmpty(INCLUDE_INSTALL_DIR) {
-    INCLUDE_INSTALL_DIR = $$PREFIX/include/libdtk-$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}
-    DTK_INCLUDEPATH = $$PREFIX/include/libdtk-$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}
-} else {
-    DTK_INCLUDEPATH = $$INCLUDE_INSTALL_DIR/libdtk-$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}
+    isEqual(TARGET, dtkcore) {
+        INCLUDE_INSTALL_DIR = $$PREFIX/include/libdtk-$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}
+    } else {
+        INCLUDE_INSTALL_DIR = $${QT.dtkcore.includes}/..
+    }
 }
 
-!isEmpty(DTK_STATIC_LIB){
+DTK_INCLUDEPATH = $$INCLUDE_INSTALL_DIR
+isEmpty(includes.path): includes.path = $$DTK_INCLUDEPATH/D$$upper($$str_member($$TARGET, 3, 3))$$str_member($$TARGET, 4, -1)
+
+!isEmpty(DTK_STATIC_LIB) {
     DEFINES += DTK_STATIC_LIB
     CONFIG += staticlib
 }
index 13e8fb9cec56f1d7aad6ed9365935fbeda1cbf4a..ef5638a76eb86dc414e0ed996a1b20a104cdfc95 100644 (file)
@@ -77,7 +77,6 @@ defineTest(updateDtkCoreConfigFile) {
 # ----------------------------------------------
 # install config
 includes.files += $$PWD/*.h $$PWD/dtkcore_config.h $$PWD/DtkCore
-includes.path = $${DTK_INCLUDEPATH}/DCore
 
 INSTALLS += includes target